#ifndef _LIGHTSWITCH_H
#define _LIGHTSWITCH_H

typedef struct _lightswitch_t {
    pthread_mutex_t mutex;
    pthread_mutex_t switcher;
    volatile unsigned int type;
    pthread_mutex_t count_mutex;
    volatile unsigned int count;
} lightswitch_t;

void lightswitch_init(lightswitch_t *switcher);

inline void lightswitch_lock(lightswitch_t *switcher, unsigned int type);

inline void lightswitch_unlock(lightswitch_t *switcher);

#endif
